home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Frameworks / MacZoop 1.6.5 / Basic Classes / Z Headers / ZEventHandler.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-07  |  1.9 KB  |  79 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZEventHandler.h        -- the event handler object
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21. #pragma once
  22.  
  23. #ifndef __ZEVENTHANDLER__
  24. #define __ZEVENTHANDLER__
  25.  
  26. #include    <AppleEvents.h>
  27.  
  28.  
  29. class    ZWindow;
  30. class    ZCommander;
  31.  
  32.  
  33. class    ZEventHandler
  34. {
  35. protected:
  36.     short            clicks;                // number of mouse-clicks in a series
  37.     EventRecord        theEvent;            // the event recovered from queue
  38.     Boolean            inBackground;        // TRUE if app in background
  39.  
  40. public:
  41.  
  42.     ZEventHandler();
  43.     
  44.     virtual void    GetAnEvent( const short mask = everyEvent );
  45.     virtual void    DispatchAnEvent();
  46.     virtual void    InstallApplescriptHandlers();
  47.     virtual void    InstallAppleEventHandler( const AEEventClass pClass, const AEEventID pID );
  48.  
  49.     virtual void    HandleWindowUpdate( const WindowPtr theWindow );
  50.     virtual void    HandleWindowActivate( const WindowPtr theWindow, const Boolean state );
  51.     
  52. protected:
  53.     virtual void    CountClicks(const WindowPtr target, const long clickTicks, const Point globalMouse );
  54.     virtual void    HandleMouseEvent( const EventRecord& theEvent );
  55.     virtual void    HandleKeyEvent( const char theKey, const Boolean isAutoKey );
  56.     virtual void    PassIdle();
  57.     virtual void    HandleHLEvent( const EventRecord& theEvent);
  58.     virtual void    HandleOSEvent( const EventRecord& theEvent);
  59.     
  60.     virtual void    ProcessDialogEvent( const DialogPtr theDialog, const short itemHit);
  61.     virtual Boolean    PrefilterDialogEvent();
  62.  
  63. public:    
  64.     inline short    GetClicks(){ return clicks;};
  65.     inline Boolean    InBackground(){ return inBackground;};
  66.     inline void        GetLatestEvent( EventRecord* anEvent ) { *anEvent = theEvent; };
  67. };
  68.  
  69.  
  70.  
  71. extern        short            gSleep;
  72. extern        ZCommander*        gCurHandler;
  73.  
  74.  
  75. #define        kFrontSleep        LMGetCaretTime()
  76. #define        kBackSleep        (kFrontSleep << 2)
  77.  
  78.  
  79. #endif